<?php
/**
 * Author：小鱼
* QQ:34734852
* Wechat:34734852
*/
namespace Home\Controller;
use Think\Controller;

class ProductController extends ActionController {
    public function Index(){
        $this->assign('pro_cate',$this->data('category', '', 'sort desc','12'));
        $this->fenye('goods','','date desc','product','page','12');
        $this->display();
    }
    public function view(){
        $goods = D('goods');
        $id = I('get.id','','strip_tags');
        $data = $goods->relation(true)->where(array('id'=>$id))->find();
//         echo "<pre>";
//         var_dump($data);
        if(!empty($id)){
            $res = $this->one_data('goods',array('id'=>$id));
            if($res == NULL){
                $this->error('非法操作！');
            }else{
                $this->assign('goods',$data);
                $this->assign('product',$this->data('goods', '', 'date desc'),'8');
                $this->display();
            }
        }else{
            $this->error('非法操作！');
        }

    }
}